﻿Imports System.IO
Imports System.Threading

Public Class frmOptions
    Dim diNameArray() As String
    Dim id As Integer = 0
    Dim addonInfo As String
    Dim FmLoad As Boolean = False
    Dim HardFailure As Boolean = False

    Private Sub frmOptions_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'This defaults the auth data to the sample above
        My.Settings.Reload()
        If My.Settings.WLMi = True Then
            cbILTL.Checked = True
        ElseIf My.Settings.WLMi = False Then
            cbILTL.Checked = False
        End If
        If My.Settings.MediaRemote = True Then
            cbSMR.Checked = True
        ElseIf My.Settings.MediaRemote = False Then
            cbSMR.Checked = False
        End If
        If cbSMR.Checked = True Then
            My.Settings.MediaRemote = True
        ElseIf cbSMR.Checked = False Then
            My.Settings.MediaRemote = False
        End If
        If My.Settings.AdvertDisable = False Then
            btnAdEnable.Enabled = False
            btnAdDisable.Enabled = True
        ElseIf My.Settings.AdvertDisable = True Then
            btnAdEnable.Enabled = True
            btnAdDisable.Enabled = False
        End If
        If My.Settings.EACStick = True Then
            cbSticktoPlayer.Checked = True
        ElseIf My.Settings.MediaRemote = False Then
            cbSticktoPlayer.Checked = False
        End If
        If My.Settings.EacOnTop = True Then
            cbEAConTop.Checked = True
        ElseIf My.Settings.EacOnTop = False Then
            cbEAConTop.Checked = False
        End If
        If My.Settings.MediaInfo = True Then
            cbMediaInfo.Checked = True
        ElseIf My.Settings.MediaInfo = False Then
            cbMediaInfo.Checked = False
        End If
        If My.Settings.VideoChoice = True Then
            cbVideoChoice.Checked = True
        ElseIf My.Settings.VideoChoice = False Then
            cbVideoChoice.Checked = False
        End If
        If My.Settings.Lyrics = True Then
            cbLyrics.Checked = True
        ElseIf My.Settings.Lyrics = False Then
            cbLyrics.Checked = False
        End If

        If My.Settings.TabHome = True Then
            cbHome.Checked = True
        ElseIf My.Settings.TabHome = False Then
            cbHome.Checked = False
        End If
        If My.Settings.TabPodcasts = True Then
            cbPodcasts.Checked = True
        ElseIf My.Settings.TabPodcasts = False Then
            cbPodcasts.Checked = False
        End If
        If My.Settings.TabYouTube = True Then
            cbYouTube.Checked = True
        ElseIf My.Settings.TabYouTube = False Then
            cbYouTube.Checked = False
        End If
        ' Get the currently selected item in the ListBox.
        Dim curItem2 As String = My.Settings.VideoPro
        ' Find the string in ListBox2.
        Dim index2 As Integer = cbVideoPro.FindString(curItem2)
        ' If the item was not found in ListBox 2 display a message box, otherwise select it in ListBox2.
        If index2 = -1 Then
            MessageBox.Show("Item is not a available Video Provider")
        Else
            cbVideoPro.SetSelected(index2, True)
        End If

        ' Get the currently selected item in the ListBox.
        Dim curItemTheme As String = My.Settings.Theme
        ' Find the string in ListBox2.
        Dim index2Theme As Integer = cbTheme.FindString(curItemTheme)
        ' If the item was not found in ListBox 2 display a message box, otherwise select it in ListBox2.
        If index2Theme = -1 Then
            MessageBox.Show("Theme is not a available")
        Else
            cbTheme.SelectedIndex = index2Theme
        End If

        If FmLoad = False Then
            Dim thrMyThread As New System.Threading.Thread( _
      AddressOf AddonLookup)
            thrMyThread.Start()
            FmLoad = True
        End If

        If My.Settings.ErrorReporting = True Then
            cbSendErrorReport.Checked = True
        ElseIf My.Settings.ErrorReporting = False Then
            cbSendErrorReport.Checked = False
        End If

        If My.Settings.FullscreenClose = True Then
            cbFullscreenClose.Checked = True
        ElseIf My.Settings.FullscreenClose = False Then
            cbFullscreenClose.Checked = False
        End If
        If My.Settings.AutoUpdate = False Then
            cbAutoUpdate.Checked = False
            txtStatus.Text = "Disabled"
            txtStatus.ForeColor = Color.Red
        ElseIf My.Settings.AutoUpdate = True Then
            cbAutoUpdate.Checked = True
            txtStatus.Text = "Enabled"
            txtStatus.ForeColor = Color.Green
        End If
        If My.Settings.LastFM = True Then
            cbLastfm.Checked = True
        ElseIf My.Settings.LastFM = False Then
            cbLastfm.Checked = False
        End If
        txtLastfmuser.Text = My.Settings.LastFMUsr
        If My.Settings.LastFMUsr.Length > 0 Then
            txtLastfmpass.Text = "**************"
            btnSave.Enabled = False
        End If
        rtbLastfmLog.Text = frmMain.rtbLFL.Text
        If My.Settings.Windows7 = True And General.isWindows7 = True Then
            cbWindows7.Checked = True
        ElseIf My.Settings.Windows7 = False And General.isWindows7 = True Then
            cbWindows7.Checked = False
        Else
            cbWindows7.Checked = False
            cbWindows7.Enabled = False
        End If
    End Sub

    Private Sub cbILTL_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbILTL.CheckedChanged
        If cbILTL.Checked = True Then
            My.Settings.WLMi = True
            My.Settings.Save()
        ElseIf cbILTL.Checked = False Then
            Call frmMain.SetMusicInfo("", "", "", , , False)
            My.Settings.WLMi = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub cbSMR_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSMR.CheckedChanged
        If cbSMR.Checked = True Then
            frmMain.niControl.Visible = True
            My.Settings.MediaRemote = True
            My.Settings.Save()
        ElseIf cbSMR.Checked = False Then
            frmMain.niControl.Visible = False
            My.Settings.MediaRemote = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub cbEAConTop_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbEAConTop.CheckedChanged
        If cbEAConTop.Checked = True Then
            My.Settings.EacOnTop = True
            My.Settings.Save()
        ElseIf cbEAConTop.Checked = False Then
            My.Settings.EacOnTop = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub btnAdEnable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdEnable.Click
        If My.Settings.AdvertDisable = False Then
            My.Settings.AdvertDisable = False
            btnAdEnable.Enabled = False
            btnAdDisable.Enabled = True
            frmMain.pbAdvert.Visible = False
            frmAbout.pbAdvert.Visible = False
            My.Settings.Save()
        ElseIf My.Settings.AdvertDisable = True Then
            My.Settings.AdvertDisable = False
            frmMain.pbAdvert.Visible = True
            frmAbout.pbAdvert.Visible = True
            btnAdDisable.Enabled = True
            btnAdEnable.Enabled = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub btnAdDisable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdDisable.Click
        If My.Settings.AdvertDisable = True Then
            My.Settings.AdvertDisable = False
            frmMain.pbAdvert.Visible = True
            frmAbout.pbAdvert.Visible = True
            btnAdEnable.Enabled = True
            btnAdDisable.Enabled = False
            My.Settings.Save()
        ElseIf My.Settings.AdvertDisable = False Then
            My.Settings.AdvertDisable = True
            frmMain.pbAdvert.Visible = False
            frmAbout.pbAdvert.Visible = False
            btnAdDisable.Enabled = False
            btnAdEnable.Enabled = True
            My.Settings.Save()
        End If
    End Sub

    Private Sub cbSticktoPlayer_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSticktoPlayer.CheckedChanged
        If cbSticktoPlayer.Checked = True Then
            My.Settings.EACStick = True
            My.Settings.Save()
        ElseIf cbSticktoPlayer.Checked = False Then
            My.Settings.EACStick = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub cbMediaInfo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbMediaInfo.CheckedChanged
        If cbMediaInfo.Checked = True Then
            My.Settings.MediaInfo = True
            My.Settings.Save()
        ElseIf cbMediaInfo.Checked = False Then
            My.Settings.MediaInfo = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub imgLastfmLogo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles imgLastfmLogo.Click, imgLastfmLogo.DoubleClick
        System.Diagnostics.Process.Start("http://last.fm")
    End Sub

    Private Sub cbVideoChoice_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbVideoChoice.CheckedChanged
        If cbVideoChoice.Checked = True Then
            My.Settings.VideoChoice = True
            My.Settings.Save()
        ElseIf cbVideoChoice.Checked = False Then
            My.Settings.VideoChoice = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub cbVideoPro_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbVideoPro.SelectedIndexChanged
        My.Settings.VideoPro = cbVideoPro.SelectedItem.ToString
        My.Settings.Save()
        If My.Settings.VideoPro = "YouTube" Then
            frmMain.tsVideoChoice.Image = My.Resources.resYoutube
        ElseIf My.Settings.VideoPro = "Yahoo Music" Then
            frmMain.tsVideoChoice.Image = My.Resources.resYahoo
        ElseIf My.Settings.VideoPro = "AOL Music" Then
            frmMain.tsVideoChoice.Image = My.Resources.resAol
        ElseIf My.Settings.VideoPro = "MTV Video" Then
            frmMain.tsVideoChoice.Image = My.Resources.resMtv
        ElseIf My.Settings.VideoPro = "last.fm" Then
            frmMain.tsVideoChoice.Image = My.Resources.resLastfmic
        Else
            frmMain.tsVideoChoice.Image = My.Resources.resMisc
        End If

    End Sub

    Private Sub cbLyrics_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbLyrics.CheckedChanged
        If cbLyrics.Checked = True Then
            My.Settings.Lyrics = True
            My.Settings.Save()
            If frmMain.tabcMain.Controls.Contains(frmMain.tabLyrics) = False Then
                frmMain.tabcMain.Controls.Add(frmMain.tabLyrics)
            End If
        ElseIf cbLyrics.Checked = False Then
            My.Settings.Lyrics = False
            My.Settings.Save()
            frmMain.tabcMain.Controls.Remove(frmMain.tabLyrics)
        End If
    End Sub

    Private Sub cbHome_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbHome.CheckedChanged
        If cbHome.Checked = True Then
            My.Settings.TabHome = True
            My.Settings.Save()
            If frmMain.tabcMain.Controls.Contains(frmMain.tabHome) = False Then
                frmMain.tabcMain.Controls.Add(frmMain.tabHome)
            End If
        ElseIf cbHome.Checked = False Then
            My.Settings.TabHome = False
            My.Settings.Save()
            frmMain.tabcMain.Controls.Remove(frmMain.tabHome)
        End If
    End Sub

    Private Sub cbYouTube_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbYouTube.CheckedChanged
        If cbYouTube.Checked = True Then
            My.Settings.TabYouTube = True
            My.Settings.Save()
            If frmMain.tabcMain.Controls.Contains(frmMain.tabYouTube) = False Then
                frmMain.tabcMain.Controls.Add(frmMain.tabYouTube)
            End If
        ElseIf cbYouTube.Checked = False Then
            My.Settings.TabYouTube = False
            My.Settings.Save()
            frmMain.tabcMain.Controls.Remove(frmMain.tabYouTube)
        End If
    End Sub

    Private Sub cbPodcasts_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbPodcasts.CheckedChanged
        If cbPodcasts.Checked = True Then
            My.Settings.TabPodcasts = True
            My.Settings.Save()
            If frmMain.tabcMain.Controls.Contains(frmMain.tabPodcasts) = False Then
                frmMain.tabcMain.Controls.Add(frmMain.tabPodcasts)
            End If
        ElseIf cbPodcasts.Checked = False Then
            My.Settings.TabPodcasts = False
            My.Settings.Save()
            frmMain.tabcMain.Controls.Remove(frmMain.tabPodcasts)
        End If
    End Sub

    Private Sub btnTestAddon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestAddon.Click
        Try
            Dim Diname As String = diNameArray(lbAddons.SelectedIndex)
            Dim fileContents As String
            fileContents = My.Computer.FileSystem.ReadAllText("addons\" & Diname & "\addon.file")
            MessageBox.Show(Diname & " | " & fileContents & vbNewLine & "Add-on Verification: OK", "Add-on Test System", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show("Please install an add-on before pressing this button", "Add-on Test System", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub

    Private Sub AddonLookup()
        Try
            Dim di As New DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory & "\addons")
            ReDim diNameArray(di.GetDirectories.Length)
            'for every subdirectory in the folder, add its name to the listbox
            For Each subdi As DirectoryInfo In di.GetDirectories
                addonInfo = My.Computer.FileSystem.ReadAllText(System.AppDomain.CurrentDomain.BaseDirectory & "\addons\" & subdi.Name & "\addon.name")
                lbAddons.Items.Add(addonInfo)
                diNameArray(id) = subdi.Name
                id = id + 1
            Next
        Catch DirectoryNotFoundException As Exception

        End Try

    End Sub

    Private Sub cbSendErrorReport_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSendErrorReport.CheckedChanged
        If cbSendErrorReport.Checked = True Then
            My.Settings.ErrorReporting = True
            My.Settings.Save()
        ElseIf cbSendErrorReport.Checked = False Then
            Dim DidWork As Integer = MessageBox.Show("During the Beta period please leave Error Reporting enabled" & vbNewLine & "Press Yes to Keep Error Repoting enabled" & vbNewLine & "Press No to Disable Error Repoting", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1)
            If DidWork = DialogResult.OK Then
                cbSendErrorReport.Checked = True
                My.Settings.ErrorReporting = True
                My.Settings.Save()
            ElseIf DidWork = DialogResult.No Then
                My.Settings.ErrorReporting = False
                My.Settings.Save()
            End If
            If My.Settings.ErrorReporting = True Then
                cbSendErrorReport.Checked = True
            End If
        End If
    End Sub

    Private Sub cbFullscreenClose_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbFullscreenClose.CheckedChanged
        If cbFullscreenClose.Checked = True Then
            My.Settings.FullscreenClose = True
            My.Settings.Save()
        ElseIf cbFullscreenClose.Checked = False Then
            My.Settings.FullscreenClose = False
            My.Settings.Save()
        End If
    End Sub

    Private Sub btnRunAddon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunAddon.Click
        Try
            Dim Diname As String = diNameArray(lbAddons.SelectedIndex)
            Dim fileContents As String
            fileContents = My.Computer.FileSystem.ReadAllText("addons\" & Diname & "\addon.file")
            System.Diagnostics.Process.Start("addons\" & Diname & "\" & fileContents)
        Catch ex As Exception
            MessageBox.Show("Please install an add-on before pressing this button")
        End Try

    End Sub

    Private Sub cbTheme_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbTheme.SelectedIndexChanged
        My.Settings.Theme = cbTheme.SelectedItem.ToString
        If cbTheme.SelectedItem.ToString = "Default" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_default
            frmMain.KryptonManager.GlobalPalette = frmMain.ThemeWhite
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartblack
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "NewBlue" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_newblue
            frmMain.KryptonManager.GlobalPalette = ComponentFactory.Krypton.Toolkit.KryptonManager.PaletteSparkleBlue
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartwhite
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "IceBlue" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_iceblue
            frmMain.KryptonManager.GlobalPalette = ComponentFactory.Krypton.Toolkit.KryptonManager.PaletteOffice2007Blue
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartblack
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "Graphite" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_graphite
            frmMain.KryptonManager.GlobalPalette = ComponentFactory.Krypton.Toolkit.KryptonManager.PaletteOffice2007Black
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartwhite
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "Graphite 2010" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_graphite2010
            frmMain.KryptonManager.GlobalPalette = ComponentFactory.Krypton.Toolkit.KryptonManager.PaletteOffice2010Black
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartwhite
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "Purple" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_purple
            frmMain.KryptonManager.GlobalPalette = frmMain.ThemePurple
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartblack
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        ElseIf cbTheme.SelectedItem.ToString = "Classic" Then
            pbThemePreview.Image = MeaMod_Playme.My.Resources.Resources.meamodplayme_classic
            frmMain.KryptonManager.GlobalPalette = ComponentFactory.Krypton.Toolkit.KryptonManager.PaletteProfessionalSystem
            frmMain.noCoverArt = MeaMod_Playme.My.Resources.resNocoverartblack
            If VideoLan.VlcState.Playing = False Then
                frmMain.tagArt.Image = frmMain.noCoverArt
            End If
            frmMain.tabPlayer.BackColor = Color.Transparent
        End If
        My.Settings.Save()
    End Sub

    Private Sub cbAutoUpdate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbAutoUpdate.CheckedChanged
        If cbAutoUpdate.Checked = False Then
            My.Settings.Reload()
            My.Settings.AutoUpdate = False
            txtStatus.Text = "Disabled"
            txtStatus.ForeColor = Color.Red
            My.Settings.Save()
        ElseIf cbAutoUpdate.Checked = True Then
            My.Settings.Reload()
            My.Settings.AutoUpdate = True
            txtStatus.Text = "Enabled"
            txtStatus.ForeColor = Color.Green
            My.Settings.Save()
        End If
    End Sub

    Private Sub btnOpenMeaUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenMeaUpdate.Click
        frmMeaUpdate.ShowDialog()
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        btnSave.Enabled = False
        My.Settings.LastFMUsr = txtLastfmuser.Text
        My.Settings.LastFMPass = General.MD5Hash(txtLastfmpass.Text)
        My.Settings.Save()
        My.Settings.Reload()
        Dim t As Thread
        t = New Thread(AddressOf frmMain.LastfmHandshake)
        t.Start()

    End Sub

    Private Sub cbLastfm_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbLastfm.CheckedChanged
        If cbLastfm.Checked = False Then
            My.Settings.Reload()
            My.Settings.LastFM = False
            My.Settings.Save()
        ElseIf cbLastfm.Checked = True Then
            My.Settings.Reload()
            My.Settings.LastFM = True
            My.Settings.Save()
        End If
    End Sub

    Private Sub txtLastfmuser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastfmpass.TextChanged
        btnSave.Enabled = True
    End Sub

    Private Sub txtLastfmuser_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLastfmuser.TextChanged
        btnSave.Enabled = True
        txtLastfmpass.Text = ""
    End Sub

    Public Sub CallLastFMlog()
        rtbLastfmLog.Text = frmMain.rtbLFL.Text
        rtbLastfmLog.Update()
    End Sub

    Private Sub cbWindows7_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbWindows7.CheckedChanged
        If cbWindows7.Checked = True Then
            My.Settings.Windows7 = True
            My.Settings.Save()
        ElseIf cbWindows7.Checked = False Then
            My.Settings.Windows7 = False
            My.Settings.Save()
        End If
        If General.isWindows7 = True And My.Settings.Windows7 = True Then
            Try
                Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance.ThumbnailToolbars.AddButtons(frmMain.Handle, frmMain.w7.buttonOpen, frmMain.w7.buttonPlay, frmMain.w7.buttonStop)
            Catch ex As InvalidOperationException
                frmMain.w7.buttonPlay.Visible = True
                frmMain.w7.buttonStop.Visible = True
                frmMain.w7.buttonOpen.Visible = True
            End Try
        ElseIf General.isWindows7 = True And My.Settings.Windows7 = False Then
            frmMain.w7.buttonPlay.Visible = False
            frmMain.w7.buttonStop.Visible = False
            frmMain.w7.buttonOpen.Visible = False
            Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance.SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState.NoProgress, frmMain.Handle)
            Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance.SetOverlayIcon(frmMain.Handle, Nothing, Nothing)
        End If
    End Sub
End Class